package com.lsl.command_pattern.example;

import com.lsl.command_pattern.example.concretecommand.HelpCommand;
import com.lsl.command_pattern.example.concretecommand.MinimizeCommand;

/**
 * description:
 *
 * @author: liushengli
 * data: 2022/12/1
 */
public class Client {
    public static void main(String[] args) {
        FBSettingWindow fbSettingWindow = new FBSettingWindow("功能键设置");

        FunctionButton functionButtonOne = new FunctionButton("功能键1");
        FunctionButton functionButtonTwo = new FunctionButton("功能键1");


        HelpCommand helpCommand = new HelpCommand();
        MinimizeCommand minimizeCommand = new MinimizeCommand();

        //将命令对象注入功能键
        functionButtonOne.setCommand(helpCommand);
        functionButtonTwo.setCommand(minimizeCommand);

        fbSettingWindow.addFunctionButton(functionButtonOne);
        fbSettingWindow.addFunctionButton(functionButtonTwo);
        fbSettingWindow.display();

        //调用功能键的业务方法
        functionButtonOne.onClick();
        functionButtonTwo.onClick();
    }
}
